<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
    function login(){
        if ($('input[name="identity"]:checked').val()=="user"){
            $.ajax({
                type: "Get",
                url: "loginServlet",
                data: {
                    "UserName": $("#UserName").val()
                },
                dataType:"json",
                success: function(result){
                    console.log(result)
                    if (($("#UserName").val())!=""&&($("#password").val())!="") {
                        if (result[0].password == $("#password").val()&&result[0].state !== 1) {
                            console.log(111)
                            window.location.href = "Main.html?userid=" + result[0].userID + "&state=" + result[0].state;
                        }
                        else if (result[0].password == $("#password").val()&&result[0].state==1){
                            $("#show").empty();
                            $("#show").append(
                                "<em style='color: red'>该用户已被封禁！</em>"
                            );
                        }
                        else if (result[result.length-1].judge=="inExistence"){
                            $("#show").empty();
                            $("#show").append(
                                "<em style='color: red'>该用户名不存在！</em>"
                            );
                        }
                        else if (result[0].password != $("#password").val()){
                            $("#show").empty();
                            $("#show").append(
                                "<em style='color: red'>密码输入错误！</em>"
                            );
                        }
                    }
                    else {
                        $("#show").empty();
                        $("#show").append(
                            "<em style='color: red'>用户名和密码不能为空！</em>"
                        );
                    }
                }
            });
        }
        else if ($('input[name="identity"]:checked').val()=="admin") {
            $.ajax({
                type: "Get",
                url: "adminLoginServlet",
                data: {
                    "UserName": $("#UserName").val(),
                },
                dataType: "json",
                success: function (result) {
                    if (($("#UserName").val())!=""&&($("#password").val())!="") {
                        if (result[0].password == $("#password").val()) {
                            window.location.href = "AdminContent.html"
                        }
                        else if (result[result.length-1].judge=="inExistence"){
                            $("#show").empty();
                            $("#show").append(
                                "<em style='color: red'>该管理员不存在！</em>"
                            );
                        }
                        else if (result[0].password != $("#password").val()){
                            $("#show").empty();
                            $("#show").append(
                                "<em style='color: red'>密码输入错误！</em>"
                            );
                        }
                    }
                    else {
                        $("#show").empty();
                        $("#show").append(
                            "<em style='color: red'>用户名和密码不能为空！</em>"
                        );
                    }
                },
            });
        }
        else {
            $("#show").empty();
            $("#show").append(
                "<em style='color: red'>请选择身份！</em>"
            );
        }
    }
</script>
<div style="font-size: 14px;
    font-weight: 400;
    color: #222226;
    background: #fff;
    -webkit-box-shadow: 0 2px 4px 0 rgb(0 0 0 / 5%);
    box-shadow: 0 2px 4px 0 rgb(0 0 0 / 5%);
    position: relative;">
    <div style="padding: 0;
    margin: 0;
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
    font-family: 'PingFang SC','SF Pro Display','Microsoft YaHei',Roboto,Noto,Arial,sans-serif;">
        <div class="top" style="width: 100%;
    min-width: 1280px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    padding: 0 24px;
    height: 48px;
    line-height: 48px;
    margin: 0 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
}">
            <div class="left" style="display: flex;align-items: center;gap: 30px;">
                <img src="static/img/猴子.png" style="display: block;
                width: 80px;
                min-width: 80px;
                height: 44px;
                margin-top: calc((48px - 44px)/ 2);">
                <ul style="float: left">
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">博客</a>
                    </li>
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">开发者文库</a>
                    </li>
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">课程</a>
                    </li>
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">问答</a>
                    </li>
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">社区</a>
                    </li>
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">插件</a>
                    </li>
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">认证</a>
                    </li>
                    <li style="position: relative;
            display: inline-block;
            list-style: none;
            font-size: 14px;
            height: 100%;
            line-height: 48px;
            }">
                        <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">开源</a>
                    </li>
                </ul>
            </div>

            <div class="search" style="-webkit-box-flex: 1;
       -ms-flex: 1;
       flex: 1;
       padding: 0 40px;">
                <div style="width: 100%;
        max-width: 720px;
        height: 32px;
        line-height: 32px;
        margin-top: calc((48px - 32px)/ 2);
        margin-left: auto;
        margin-right: auto;
        position: relative;
        }">
                    <div style="width: 100%;
        height: 100%;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        font-size: 0;">
            <span style="position: absolute;
            display: inline-block;
            width: 16px;
            height: 16px;
            background-size: contain;
            margin-right: 3px;
            background: url(static/img/img_1.png) no-repeat -32px 0;
            background-size: 300%;
            left: 12px;
            top: 8px;"></span>
                        <input style="font-size: 14px;
            display: inline-block;
            width: calc(100% - 104px);
            height: 100%;
            line-height: inherit;
            border: 0 none;
            outline: 0;
            background: #f5f6f7;
            color: #222226;
            vertical-align: top;
            text-indent: 32px;
            border: 1px solid #e8e8ed;
            border-right: none;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            border-radius: 16px 0 0 16px;">
                        <button style="display: inline-block;
            width: 88px;
            height: 100%;
            outline: 0;
            border: 0 none;
            border-radius: 0 16px 16px 0;
            font-size: 14px;
            line-height: 32px;
            cursor: pointer;
            -webkit-transition: all .2s ease-in;
            transition: all .2s ease-in;
            background-color: #fc5531;
            text-align: left;">
                            <i style="display: inline-block;
            width: 24px;
            height: 24px;
            background: url(https://g.csdnimg.cn/common/csdn-toolbar/images/csdn-white-search.png) no-repeat center center;
            background-size: 100%;
            vertical-align: middle;
            position: relative;
            top: -1px;
            margin-left: 14px;"></i>
                            <span style="display: inline-block;
                vertical-align: top;
                color: #fff;">搜索</span>
                        </button>
                    </div>
                </div>
            </div>

            <div style="float: left">
                <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">登录/注册</a>
            </div>
            <div style="float: left">
                <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">
                    会员中心
                    <img src="static/img/20210918025138.gif" style="-webkit-text-size-adjust: 100%;
            -webkit-tap-highlight-color: rgba(0,0,0,0);
            font-size: 14px;
            font-weight: 400;
            text-align: center;
            line-height: inherit;
            color: inherit;
            border: 0;
            padding: 0;
            margin: 0;
            box-sizing: content-box;
            font-family: 'PingFang SC','SF Pro Display','Microsoft YaHei',Roboto,Noto,Arial,sans-serif;
            position: relative;
            vertical-align: middle;
            width: 14px;
            top: -2px;
            left: 0px;
            display: inline-block;">
                </a>
            </div>
            <div style="float: left">
                <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">足迹</a>
            </div>
            <div style="float: left">
                <a style="text-decoration: none;
            display: block;
            height: 100%;
            color: inherit;
            padding: 0 10px;">动态</a>
            </div>

            <div style="height: 100%;padding-right: 0;">
                <button style=";
                display: block;
                height: 100%;
                width: 88px;
                border: 0px;
                background: url(static/img/btn-write-new.gif) no-repeat center center;
                background-size: 88px 32px;
                padding: 0 10px;"></button>
            </div>
        </div>
    </div>
</div>

<div style="width: 100%;
    height: calc(100% - 140px);
    background: url(static/img/登录背景.png) no-repeat 50%;
    background-size: cover;
    min-height: 888px;
    position: relative;">
    <div style="width: calc(100% - 120px);background: transparent;
    position: absolute;
    top: 50%;
    left: 50%;
    height: 520px;
    transform: translate(-50%,-55%);
    clear: both;
    max-width: 1520px;">

        <div style="width: 419px;
            height: 100%;
            float: left;">
            <div style="width: 100%;
                height: 100%;
                padding: 0;">
                <h4 style="overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    font-size: 16px;
                    line-height: 34px;
                    height: 34px;
                    font-size: 28px;
                    color: #fff!important;
                    font-weight: 400;
                    margin: 130px 0 24px;">戈登·摩尔提出摩尔定律</h4>
                <p style="color: #fff!important;
                    line-height: 34px;
                    height: 246px;
                    overflow-y: auto;">1965 年 4 月 19 日，戈登·摩尔提出摩尔定律。英特尔创始人之一戈登·摩尔在《电子学》杂志发表了一篇文章，提出了“摩尔定律”。其内容为：集成电路上可容纳的晶体管数目，约每隔两年便会增加一倍。</p>
                <span style="left: 0;position: absolute;
                    box-sizing: border-box;
                    min-width: 120px;
                    height: 40px;
                    padding: 0 10px;
                    color: #fc5531;
                    text-align: center;
                    line-height: 40px;
                    border-radius: 24px 24px;
                    border: 1px solid #fc5531;
                    left: 40px;
                    bottom: 40px;
                    cursor: pointer;
                    -webkit-user-select: none;
                    -moz-user-select: none;
                    -ms-user-select: none;
                    user-select: none;">
                        <i style="display: inline-block;
                        width: 18px;
                        height: 18px;
                        background: url(static/img/img_3.png) no-repeat 50%;
                        background-size: cover;
                        position: relative;
                        vertical-align: middle;
                        top: -3px;
                        margin-right: 8px;
                        animation-duration: 1s;"></i>
                        2315</span>
            </div>
        </div>

        <div style="position: relative;
        width: 410px;
        height: 468px;
        margin-top: 52px;
        float: right;">

            <div style="position: absolute;
            top: -52px;
            right: 40px;">
                <img style="width: 56px;height: 56px;" src="static/img/img_4.png">
            </div>

            <div style="width: 100%;
            height: 100%;
            border-radius: 2px 2px;
            background: #fff;
            box-sizing: border-box;">

                <div style="width: 100%;
                height: calc(100% - 128px);
                padding: 40px 25px 16px;
                box-sizing: border-box;
                border-top-left-radius: 2px;
                border-top-right-radius: 2px;
                clear: both;">

                    <div style="width: 100%;display: block;box-sizing: border-box;">
                        <div style="font-size: 0;
                        font-weight: 600;
                        color: #999aaa;
                        height: 22px;
                        line-height: 22px;
                        box-sizing: content-box;
                        padding-bottom: 8px;
                        margin-bottom: 32px;
                        display: -ms-flexbox;
                        display: flex;
                        -ms-flex-pack: justify;
                        justify-content: space-between;
                        position: relative;">
                            <span style="min-width: 120px;
                            display: inline-block;
                            font-size: 16px;
                            position: relative;
                            cursor: pointer;
                            -webkit-user-select: none;
                            -moz-user-select: none;
                            -ms-user-select: none;
                            user-select: none;
                            text-align: center;
                            box-sizing: border-box;">
                                微信登录
                            </span>
                            <span style="min-width: 120px;
                            display: inline-block;
                            font-size: 16px;
                            position: relative;
                            cursor: pointer;
                            -webkit-user-select: none;
                            -moz-user-select: none;
                            -ms-user-select: none;
                            user-select: none;
                            text-align: center;box-sizing: border-box;">
                                免密登录
                            </span>
                            <span style="color: #222226;min-width: 120px;
                            display: inline-block;
                            font-size: 16px;
                            position: relative;
                            cursor: pointer;
                            -webkit-user-select: none;
                            -moz-user-select: none;
                            -ms-user-select: none;
                            user-select: none;
                            text-align: center;box-sizing: border-box;}">
                                密码登录
                            </span>
                        </div>
                        <div style="padding-right: 0;box-sizing: border-box;">
                            <div style="box-sizing: border-box;">
                                <div style="box-sizing: border-box;">
                                    <div style="width: 100%;
                                    height: 40px;
                                    line-height: 40px;
                                    background: #f5f6f7;
                                    border-radius: 4px 4px;
                                    padding: 0 16px;
                                    color: #222226;
                                    font-size: 14px;
                                    font-weight: 400;
                                    position: relative;
                                    clear: both;box-sizing: border-box;">
                                        <input id="UserName" placeholder="手机号/邮箱/用户名" style="display: block;
                                        width: 100%;
                                        height: 100%;
                                        border: none;
                                        background: #f5f6f7;
                                        outline: none;
                                        font-family: inherit;
                                        font-size: inherit;
                                        line-height: inherit;
                                        color: inherit;
                                        font: inherit;
                                        margin: 0;box-sizing: border-box;">
                                        <span style="display: block;
                                        position: absolute;
                                        width: 16px;
                                        height: 16px;
                                        top: 12px;
                                        right: 16px;
                                        cursor: pointer;box-sizing: border-box;"></span>
                                    </div>
                                </div>
                                <div style="margin-top: 16px;box-sizing: border-box;">
                                    <div style="width: 100%;
                                    height: 40px;
                                    line-height: 40px;
                                    background: #f5f6f7;
                                    border-radius: 4px 4px;
                                    padding: 0 16px;
                                    color: #222226;
                                    font-size: 14px;
                                    font-weight: 400;
                                    position: relative;
                                    clear: both;box-sizing: border-box;">
                                        <input id="password" type="password" placeholder="密码" style="display: block;
                                        width: 100%;
                                        height: 100%;
                                        border: none;
                                        background: #f5f6f7;
                                        outline: none;
                                        font-family: inherit;
                                        font-size: inherit;
                                        line-height: inherit;
                                        color: inherit;
                                        font: inherit;
                                        margin: 0;box-sizing: border-box;">
                                        <span style="background: url(static/img/可见.png) no-repeat 50%/cover;display: block;
                                        position: absolute;
                                        width: 16px;
                                        height: 16px;
                                        top: 12px;
                                        right: 16px;
                                        cursor: pointer;box-sizing: border-box;"></span>
                                    </div>
                                </div>
                                <div style="margin: 8px 0 24px;
                                height: 16px;
                                font-size: 12px;
                                font-weight: 400;
                                color: #222226;
                                line-height: 16px;
                                padding-left: 16px;
                                padding-right: 16px;box-sizing: border-box;">
                                    <span style="float: left;
                                    display: block;
                                    height: 100%;
                                    color: #fc5531;box-sizing: border-box;"></span>
                                    <a href="Enroll.html" style="float: right;color: #2e2e2e;text-decoration: none;background-color: transparent;box-sizing: border-box;">注册账号</a>
                                </div>

                                <from>
                                    <input type="radio" name="identity" value="user">普通用户
                                    <input type="radio" name="identity" value="admin">管理员
                                </from>




                                <div style="box-sizing: border-box;">
                                    <button onclick="login()" style="cursor: default;
                                    cursor:pointer;
                                    color: #fff;
                                    display: inline-block;
                                    width: 100%;
                                    height: 40px;
                                    line-height: 40px;
                                    outline: none;
                                    text-align: center;
                                    background: #fc5531;
                                    border-radius: 20px 20px;
                                    border: 0 none;
                                    ont-family: inherit;
                                    -webkit-appearance: button;
                                    text-transform: none;
                                    overflow: visible;
                                    font: inherit;
                                    margin: 0;box-sizing: border-box;">登录</button>
                                </div>

                                <div id="show" align="center" style="margin-top:25px; box-sizing: border-box;"></div>
                            </div>
                        </div>
                    </div>

                </div>


                <div style="width: 100%;
                border-bottom-left-radius: 2px;
                border-bottom-right-radius: 2px;
                box-sizing: border-box;
                padding: 0 24px 24px;
                font-size: 12px;
                color: #555666;">
                    <div style="box-sizing: border-box;">
                        <p style="height: 24px;
                        font-size: 12px;
                        font-weight: 400;
                        color: #999aaa;
                        line-height: 24px;
                        text-align: center;
                        margin-bottom: 8px;box-sizing: border-box;">其他登录方式</p>
                        <div style="font-size: 0;position: relative;box-sizing: border-box;text-align: center;">
                            <span style="background: url(static/img/img_5.png) no-repeat 50%/cover;display: inline-block;
                            width: 32px;
                            height: 32px;
                            border-radius: 50% 50%;
                            cursor: pointer;box-sizing: border-box;"></span>
                            <span style="margin-left: 12px;background: url(static/img/img_6.png) no-repeat 50%/cover;display: inline-block;
                            width: 32px;
                            height: 32px;
                            border-radius: 50% 50%;
                            cursor: pointer;box-sizing: border-box;"></span>
                            <span style="margin-left: 12px;
                            display: inline-block;
                            width: 32px;
                            height: 32px;
                            border-radius: 50% 50%;
                            cursor: pointer;
                            background: url(static/img/img_7.png) no-repeat 50%/cover;
                            box-sizing: border-box;
                            "></span>
                            <span style="margin-left: 12px;background: url(static/img/img_8.png) no-repeat 50%/cover;display: inline-block;
                            width: 32px;
                            height: 32px;
                            border-radius: 50% 50%;
                            cursor: pointer;box-sizing: border-box;"></span>
                            <span style="margin-left: 12px;background: url(static/img/img_9.png) no-repeat 50%/cover;display: inline-block;
                            width: 32px;
                            height: 32px;
                            border-radius: 50% 50%;
                            box-sizing: border-box;
                            cursor: pointer;"></span>
                            <span style="margin-left: 12px;background: url(static/img/img_10.png) no-repeat 50%/cover;display: inline-block;
                            width: 32px;
                            height: 32px;
                            border-radius: 50% 50%;
                            cursor: pointer;box-sizing: border-box;"></span>
                        </div>
                    </div>
                    <p style="box-sizing: border-box;">
                        未注册用户扫码后自动登录，注册即代表同意
                        <a style="text-decoration: underline;
                        display: inline-block;
                        padding: 0;color: #2e2e2e;background-color: transparent;box-sizing: border-box;">服务条款</a> 和
                        <a style="text-decoration: underline;
                        display: inline-block;
                        padding: 0;color: #2e2e2e;background-color: transparent;box-sizing: border-box;">隐私协议</a>
                    </p>
                </div>

            </div>

        </div>

    </div>


</div>

</body>
</html>